﻿@model QLMB.ViewModels.RouteInfo

@{
    ViewBag.Title = "GetCity";
    Layout = "~/Views/Shared/_LayoutAdmin.cshtml";
}

<h2>GetCity</h2>

<script language = "javascript" type ="text/javascript">
    $(document).ready(function () {
        $("#TpDi").change(function () {
            var idTpDi = $(this).val();
            $.getJSON("/Flight/GetListArriveAirport/", { id: idTpDi },
                function (json) {
                    var select = $("#TpDen");
                    select.empty();
                    select.attr("data-val", true);
                    select.attr("data-val-required", "Vui long chon san bay den");
                    select.attr("class", "input-validation-error");
                    select.append($('<option/>', {
                        Text: " "
                    }));
                    $.each(json, function (index, itemData) {
                        select.append($('<option/>', {
                            value: itemData.Value,
                            text: itemData.Text
                        }));
                    });
                });
        });

        $("#TpDen").change(function () {
            if ($(this).val() != 0)
                $(this).attr("class", "valid");
            else
                $(this).attr("class", "input-validation-error");
        });

        $('.date').datepicker({ dateFormat: "mm/dd/yy", maxDate: '+1y', minDate: '+3d' });
    });

</script>



<fieldset>
    <legend>Dat ve may bay</legend>
    <div class = "form">
    @using (Html.BeginForm())
    {
        <table border = 0>
            <tr>
                <td>
                <div class = "editor-label">
                    @Html.Label("Thành phố đi")
                </div>
                <div class = "editor-field">
                    @Html.DropDownListFor(x => x.TpDi, new SelectList(Model.DSTpDi, "Value", "Text"), " ")<br />
                    @Html.ValidationMessageFor(x => x.TpDi)
                </div>
                </td>
                <td>
                <div class = "editor-label">
                    @Html.Label("Thành phố đến")
                </div>
                <div class = "editor-field">
                    @Html.DropDownListFor(x => x.TpDen, new SelectList(Model.DSTpDen, "Value", "Text"), " ")<br />
                    @Html.ValidationMessageFor(x => x.TpDen)
                </div>
                </td>
            </tr>
            <tr>
                <td>
                    Thoi gian di: 
                    <div class = "editor-field" align = "left">
                    @Html.EditorFor(x => x.Ngay)<br />
                    @Html.ValidationMessageFor(x=>x.Ngay)<br />
                    </div>
                </td>
                <td>
                <div>
                    <div>@Html.LabelFor(x => x.Gio)</div>
                    @Html.EditorFor(x => x.Gio)
                    @Html.ValidationMessageFor(x=>x.Gio)
                </div>
                </td>
                <td>
                    <div>@Html.LabelFor(x=>x.Phut)</div>
                    @Html.EditorFor(x=>x.Phut)
                    @Html.ValidationMessageFor(x=>x.Phut)
                </td>
            </tr>
            <tr>
                <td colspan = "2">
                    <div align= "center">
                      <input type="submit" value="Tạo chuyến bay" />
                    </div>
			    </td>
            </tr>
      </table>
    }</div>
</fieldset>

